<!DOCTYPE html>

<html lang="en" xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="utf-8" />
    <title></title>
    <script src="./node_modules/vue/dist/vue.min.js"></script>
    <link rel="stylesheet" href="./node_modules/animate.css/animate.min.css">
    <style>
    .ball{
        width: 15px;
        height: 15px;
        border-radius: 50%;
        background-color: red;
    }
    </style>
</head>
<body>
<div id="app">
    <input type="button" value="toggle" @click="flag=!flag"/>
    <transition @before-enter="beforeEnter" @enter="enter" @after-enter="afterEnter">
        <div v-show="flag" class="ball"></div>
    </transition>
</div>

<script>
    var vm=new Vue({
        el:"#app",
        data:{
            flag:false
    
        },
        methods:{
            beforeEnter(el){
                el.style.transform="translate(0,0)";
            },
            enter(el,done){
                el.offsetWidth;
                el.style.transform="translate(150px,450px)";
                el.style.transition="all 1s ease";
                done();
            },
            afterEnter(el){
                this.flag=!this.flag;
            }
        }
    })
    </script>
</body>
</html>